package com.training.admin.web.controller.project;

import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

import com.demo2do.core.entity.page.Page;
import com.demo2do.core.web.interceptor.MenuSetting;
import com.training.admin.entity.security.Login;

/**
 * 
 * @author Rockett
 * 
 */
@Controller
@RequestMapping("/project-surveys")
@MenuSetting("menu-training-project")
public class ProjectSurveyController {
    
    /**
     * 
     * @return
     */
	@RequestMapping(value = "", method = RequestMethod.GET)
	@MenuSetting("submenu-project-survey-management")
    public ModelAndView listProjectData(Page page) {
		ModelAndView modelAndView = new ModelAndView("project-result/project-survey-list");
		
		return modelAndView;
    }
	
	/**
	 * 
	 * @return
	 */
	@RequestMapping(value = "/{id}", method = RequestMethod.GET)
	@MenuSetting("submenu-project-survey-management")
	public ModelAndView view() {
		ModelAndView modelAndView = new ModelAndView("project-result/project-survey-view");
		return modelAndView;
	}
	
	/**
	 * 
	 * @return
	 */
	@SuppressWarnings("unused")
    @RequestMapping(value = "/{id}/{phase}", method = RequestMethod.GET)
	@MenuSetting("submenu-project-survey-management")
	public ModelAndView survey() {
		Login login = (Login)SecurityContextHolder.getContext().getAuthentication().getPrincipal();

		//todo check if current logon user can input this survey
		ModelAndView modelAndView = new ModelAndView("project-result/project-survey-input");
		return modelAndView;
	}
	
	/**
	 * 
	 * @return
	 */
	@RequestMapping(value = "/{id}/{phase}", method = RequestMethod.POST)
	@MenuSetting("submenu-project-survey-management")
	public ModelAndView onSurvey() {
		ModelAndView modelAndView = new ModelAndView("project-result/project-survey-list");
		return modelAndView;
	}

    
}
